package com.example.springstudy.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.springstudy.dao.dto.DeptDto;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@TableName("dept")
public class Dept {
    @TableId
    private Integer id;
    private Integer parentId;
    private Date createTime;
    private Date updateTime;
    private String remark;
    private Long createBy;
    private Long updateBy;
    private Integer isDeleted;

    private String name;
    private String code;
    private Integer level;

    public Dept(DeptDto deptDto) {
        this.id = deptDto.getId();
        this.name = deptDto.getName();
        this.code = deptDto.getCode();
        this.parentId = deptDto.getParentId();
        this.level = deptDto.getLevel();
        this.remark = deptDto.getRemark();
    }
}
